#import "SEGSubmitowneratuhapprovalManager.h"

#if __has_include(<Commom/SEGModel.h>)
#import <Commom/SEGModel.h>
#else
#import "SEGModel.h"
#endif
#if __has_include(<Commom/SEGHTTPBusinessManager.h>)
#import <Commom/SEGHTTPBusinessManager.h>
#else
#import "SEGHTTPBusinessManager.h"
#endif

static id _submitOwnerAtuhApprovalManager;
static dispatch_once_t onceToken;

@implementation SEGSubmitowneratuhapprovalManager
#pragma mark - SINGLE----BEGIN----
+(instancetype)sharedManager{
    dispatch_once(&onceToken, ^{
        _submitOwnerAtuhApprovalManager = [[self alloc] init];
    });
    return _submitOwnerAtuhApprovalManager;
}

+(void)destroyResource{
    onceToken = 0;
    _submitOwnerAtuhApprovalManager = nil;
}

#pragma mark - SINGLE----END----

#pragma mark - HTTP----BEGIN----
-(void)requestSubmitowneratuhapprovalWithRelid:(NSString*)relId userType:(NSString*)userType inTime:(NSString*)inTime outTime:(NSString*)outTime gender:(NSString*)gender finished:(void(^)(BOOL isSuccessed,id result,NSString* codeType,NSString* errorMessage))finished{
    
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setValue:relId forKey:@"relId"];
    [params setValue:userType forKey:@"userType"];
    [params setValue:inTime forKey:@"inTime"];
    [params setValue:outTime forKey:@"outTime"];
    [params setValue:gender forKey:@"gender"];
    
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL,@"/uhomecp-sso/v2/userHouse/submitOwnerAtuhApproval",nil];
    [SEGHTTPBusinessManager seg_requestWithMethod:POST URLString:urlString parameters:params completed:^(BOOL isSuccessed, id result, NSString *codeType, NSError *error) {
        if (!isSuccessed) {
            finished(isSuccessed,nil,codeType,error.localizedDescription);
            return;
        }
        
        self.submitOwnerAtuhApproval = [SEGSubmitowneratuhapprovalModel yy_modelWithDictionary:result];
        finished(isSuccessed,result,codeType,error.localizedDescription);
        return;
    }];
}
#pragma mark - HTTP----END----

#pragma mark - GETTER----BEGIN----
-(SEGSubmitowneratuhapprovalModel *)submitOwnerAtuhApproval{
    if (!_submitOwnerAtuhApproval) {
        _submitOwnerAtuhApproval = [[SEGSubmitowneratuhapprovalModel alloc]init];
    }
    return _submitOwnerAtuhApproval;
}
#pragma mark - GETTER----END----
@end
